package crypto

import "hash"

type Hasher interface {
	Hash(msg []byte) []byte
	GetHash() hash.Hash
}

type hasher struct {
	hash func() hash.Hash
}

func (h hasher) Hash(msg []byte) []byte {
	hasher := h.GetHash()
	hasher.Write(msg)
	return hasher.Sum(nil)
}

func (h hasher) GetHash() hash.Hash {
	return h.hash()
}
